package com.zjdiepu.www.commpent.mapper.his;

import javax.annotation.Resource;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.his.dto.HisYwBusinessBuyer;

/**
 * 项目名称：dpqc-parent-manager-information <br/> 
 * 类名称：YwBusinessBuyerVoMapper <br/>  
 * 类描述： 购车人信息<br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年4月26日 下午1:33:37  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年4月26日 下午1:33:37   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class HisYwBusinessBuyerVoMapper extends BaseMapper<HisYwBusinessBuyer>{
	@Resource
	private RedisObjectClient redisObjectClient;
	@Override
	public void mapper(RedisConnection redisConnection,HisYwBusinessBuyer m) {
		if(null == m) {
			return;
		}
		String carManType = m.getCarManType();
		SimpleDataDictionary simpleDataDictionary = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),carManType, DataDicType.CREDIT_PEOPLE_TYPE.getCode());
		m.setCarManTypeDisplay(simpleDataDictionary == null ? "" : simpleDataDictionary.getName());
		
		String sex = m.getSex();
		SimpleDataDictionary simpleDataDictionary1 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),sex, DataDicType.SEX.getCode());
		m.setSexDisplay(simpleDataDictionary1 == null ? "" : simpleDataDictionary1.getName());
		
		String maritalStatus = m.getMaritalStatus();
		SimpleDataDictionary simpleDataDictionary2 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),maritalStatus, DataDicType.MARITAL_STATUS.getCode());
		m.setMaritalStatusDisplay(simpleDataDictionary2 == null ? "" : simpleDataDictionary2.getName());
		
		String education = m.getEducation();
		SimpleDataDictionary simpleDataDictionary3 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),education, DataDicType.EDUCATION.getCode());
		m.setEducationDisplay(simpleDataDictionary3 == null ? "" : simpleDataDictionary3.getName());
		
		String workAge = m.getWorkAge();
		SimpleDataDictionary simpleDataDictionary4 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),workAge, DataDicType.WORK_AGE.getCode());
		m.setWorkAgeDisplay(simpleDataDictionary4 == null ? "" : simpleDataDictionary4.getName());
		
		String contact1Relation = m.getContact1Relation();
		SimpleDataDictionary simpleDataDictionary5 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),contact1Relation, DataDicType.CONTACT_RELATION.getCode());
		m.setContact1RelationDisplay(simpleDataDictionary5 == null ? "" : simpleDataDictionary5.getName());
		
		String contact2Relation = m.getContact2Relation();
		SimpleDataDictionary simpleDataDictionary6 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),contact2Relation, DataDicType.CONTACT_RELATION.getCode());
		m.setContact2RelationDisplay(simpleDataDictionary6 == null ? "" : simpleDataDictionary6.getName());
		
		String jobStatus = m.getJobStatus();
		SimpleDataDictionary simpleDataDictionary7 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),jobStatus, DataDicType.JOB_STATUS.getCode());
		m.setJobStatusDisplay(simpleDataDictionary7 == null ? "" : simpleDataDictionary7.getName());
		
		String job = m.getJob();
		SimpleDataDictionary simpleDataDictionary8 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),job, DataDicType.JOB.getCode());
		m.setJobDisplay(simpleDataDictionary8 == null ? "" : simpleDataDictionary8.getName());
		
		String affiliateStatus = m.getAffiliateStatus();
		SimpleDataDictionary simpleDataDictionary9 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),affiliateStatus, DataDicType.AFFILIATE_STATUS.getCode());
		m.setAffiliateStatusDisplay(simpleDataDictionary9 == null ? "" : simpleDataDictionary9.getName());
	}
}
